﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PloobsEngine.Modelo;
using LTreesLibrary.Trees;

namespace PloobsEngine.Material
{
    public class TreeShader : IShader
    {
        public override MaterialType MaterialType
        {
            get { return MaterialType.DEFERRED; }
        }

        public override void  Draw(IModelo modelo, PloobsEngine.SceneControl.IRenderHelper render, PloobsEngine.Cameras.ICamera cam)
        {
            SimpleTree tree = (modelo as TreeModel).Tree;

            EngineStuff.GraphicsDevice.RenderState.DepthBufferEnable = true;
            EngineStuff.GraphicsDevice.RenderState.DepthBufferWriteEnable = true;
            EngineStuff.GraphicsDevice.RenderState.AlphaBlendEnable = false;

            tree.DrawTrunk(obj.getWorldMatrix(), cam.View, cam.Projection);

            tree.DrawLeaves(obj.getWorldMatrix(), cam.View, cam.Projection);

            EngineStuff.GraphicsDevice.RenderState.DepthBufferEnable = true;
            EngineStuff.GraphicsDevice.RenderState.DepthBufferWriteEnable = true;
            EngineStuff.GraphicsDevice.RenderState.AlphaTestEnable = false;
            EngineStuff.GraphicsDevice.RenderState.AlphaBlendEnable = false;
        }

    }
}
